home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 7
/
Apprentice-Release7.iso
/
Source Code
/
Pascal
/
Applications
/
NIH Image 1.62b11
/
Macros
/
Particle Analysis
< prev
next >
Wrap
Text File
|
1994-05-06
|
2KB
|
78 lines
macro 'Particle Analysis Test';
var
x,y,rows,columns,maxradius,radius:integer;
begin
SaveState;
rows:=5; columns:=5;
maxradius:=rows*columns;
SetForegroundColor(255);
SetBackgroundColor(0);
SetNewSize(columns*maxradius*2+20,rows*maxradius*2+20);
MakeNewWindow('Objects');
radius:=1;
for y:=0 to columns-1 do
for x:=0 to rows-1 do begin
MakeOvalRoi(x*maxradius*2+10,y*maxradius*2+10,radius*2,radius*2);
Fill;
radius:=radius+1;
end;
KillRoi;
SetParticleSize(1,9999);
LabelParticles(true);
OutlineParticles(true);
SetOptions('Area, Perimeter, Major, Minor');
AnalyzeParticles;
SetUser1Label('Perim.d');
SetUser2Label('Area');
for radius:=1 to maxradius do begin
rUser1[radius]:=2*3.14159*radius;
rUser2[radius]:=3.14159*sqr(radius);
end;
ShowResults;
RestoreState;
end;
macro 'Count Particles at Random Locations';
var
n,i,width,height,PicID,nLocations:integer;
size:real;
begin
RequiresVersion(1.44);
nLocations:=10;
size:=0.25;
n:=1;
GetPicSize(width,height);
PicID:=PicNumber;
SetUser1Label('Count');
SetOptions('User1');
for i:=1 to nLocations do begin
SelectPic(PicID);
MakeRoi((1-size)*width*random,(1-size)*height*random,size*width,size*height);
Duplicate('Temp');;
SetDensitySlice(255,255);
AnalyzeParticles;
Dispose;
rUser1[i]:=rCount;
end;
KillRoi;
SetCounter(nLocations);
ShowResults;
end;
macro 'Analyze Particles and Compute Sum';
var
i:integer;
begin
AnalyzeParticles;
SetUser1Label('Sum');
for i:=1 to rCount do begin
rUser1[i]:=rMean[i]*rArea[i];
end;
UpdateResults;
end;